Skip to content

Fix on resume flicker (Android)#302

Open
buhleryesco wants to merge 3 commits intoCap-go:mainfrom
buhleryesco:fixResumeFlicker
Open

Fix on resume flicker (Android)#302
buhleryesco wants to merge 3 commits intoCap-go:mainfrom
buhleryesco:fixResumeFlicker

Conversation

@buhleryesco
Copy link
Contributor

@buhleryesco buhleryesco commented Feb 5, 2026

What

  • Changed onHandleResume in Android to initially set to black if config is set toBack : true. This avoided flickering/racing condition as the camera resumed.

Why

  • A previous PR had fixed the on start flickering but this part was missed. Makes for a more pleasant and consistent UI for users.

How

-Set to black like the on start method did.

Testing

-Tested on Samsung Galaxy A16

Not Tested

-Non samsung devices

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed camera preview flickering when positioned behind the WebView on Android during app resume.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

The PR adds black background color settings to the Android camera preview activity during resume to prevent visual flicker when the camera view is positioned behind the WebView, and reorganizes npm dependencies by moving development-only packages from dependencies to devDependencies.

Changes

Cohort / File(s) Summary
Android Camera Preview Flicker Fix
android/src/main/java/app/capgo/capacitor/camera/preview/CameraPreview.java
Adds window and WebView background color initialization (black) during activity resume when a previous camera session exists and is configured to render behind the WebView (toBack), executed before camera session recreation.
Dependency Reorganization
package.json
Moves typescript and prettier-pretty-check from dependencies to devDependencies; adds @rollup/rollup-darwin-x64 as a platform-specific dev dependency. Reflects development-only tooling separation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • bug: Android Flickering on Resume. #298: Directly addresses Android resume flicker prevention when camera view is positioned behind WebView by implementing the same background color initialization approach in CameraPreview.java resume logic.

Possibly related PRs

  • fix(android): fix camera stop races #245: Modifies CameraPreview.java camera session lifecycle handling (lastSessionConfig and resume/stop behavior), creating overlap in the same code area and lifecycle management patterns.

Poem

🐰 A flicker fixed with shadows deep,
Black backgrounds guard while WebViews sleep,
Dependencies sorted, clean and neat,
Camera preview now skips the beat! ✨📱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix on resume flicker (Android)' clearly and directly summarizes the main change in the pull request, which is addressing a visual flicker issue that occurs when the Android camera preview resumes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant